package com.scrumtrek.trainings.tdd.model;

/**
 * Created with IntelliJ IDEA.
 * User: Vadim
 * Date: 11.09.13
 * Time: 10:29
 * To change this template use File | Settings | File Templates.
 */
public class Book extends Item {
    private String publisher;
    private String author;
    private String year;

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public Book(String name, String author) {
        this.setName(name);
        this.author = author;
    }

    public Book(String title, String author, String publisher) {
        this(title, author);
        this.publisher = publisher;
    }

    public Book(String title, String author, String publisher, String year) {
        this(title, author, publisher);
        this.year = year;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }


    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    @Override
    public String toString() {
        return getName() + ((getPublisher() == null || getPublisher().isEmpty()) ? "" : " [" + getPublisher() + "]")
                + ((getYear() == null || getYear().isEmpty()) ? "" : " [" + getYear() + "]");
    }
}